package com.tcwong.redis.listener;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Description
 *
 * @author tcwong
 * @date 2021/11/13
 * Since 1.8
 */
@Slf4j
@Component
public class RedisMessageListenerService implements MessageListener {

    @Value("${server.port}")
    private Integer port;

    @SneakyThrows
    @Override
    public void onMessage(Message message, byte[] bytes) {
        log.info("端口:{}服务，监听消息:{}",port,message.toString());
    }
}
